package com.funong.matrix.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author NaNa
 * @since 2020-05-27 17:12
 */
@Getter
@AllArgsConstructor
public enum FileCategoryType {

    /**
     * 文件路径类型
     */
    DEFAULT("-1", "默认", "系统", 0),
    PDF("10", "pdf", "PDF", 0),
    HTML("11", "html", "HTML", 0),
    WORD("12", "word", "WORD", 0),
    ZIP("13", "zip", "ZIP", 0),

    /**
     * 附件文件类型
     */
    PREPARE_PROJECT("1000", "储备库", "系统组装", 0),

    ;


    private String code;
    private String msg;
    private String source;
    private int sort;

    public static FileCategoryType valueInfoOf(String code) {
        return Arrays.stream(values())
                .filter(fileCategoryType -> Objects.equals(code, fileCategoryType.code))
                .findFirst()
                .orElse(DEFAULT);
    }
}
